package com.example.qrcodecamera;

import android.os.Bundle;
import android.content.Intent;
import android.widget.Button;
import android.widget.Toast;

import androidx.appcompat.app.AppCompatActivity;

public class MIduserActivity extends AppCompatActivity {

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_miduser);

        // 添加按钮点击事件
        Button btnMaterial = findViewById(R.id.btn_material_info);
        Button btnWeightRecord = findViewById(R.id.btn_weight_record);
        Button btnBack = findViewById(R.id.btn_back);
        
        if (btnMaterial != null) {
            btnMaterial.setOnClickListener(v -> {
                startActivity(new Intent(this, UsermaterialdecodeActivity.class));
            });
        } else {
            Toast.makeText(this, "按钮未找到: btn_material_info", Toast.LENGTH_SHORT).show();
        }

        if (btnWeightRecord != null) {
            btnWeightRecord.setOnClickListener(v -> {
                startActivity(new Intent(this, UserWeightRecordDecodeActivity.class));
            });
        } else {
            Toast.makeText(this, "按钮未找到: btn_weight_record", Toast.LENGTH_SHORT).show();
        }
        
        // 返回按钮点击事件
        if (btnBack != null) {
            btnBack.setOnClickListener(v -> {
                startActivity(new Intent(this, LoginActivity.class));
                finish(); // 结束当前Activity
            });
        } else {
            Toast.makeText(this, "按钮未找到: btn_back", Toast.LENGTH_SHORT).show();
        }
    }
}